from django.db import models


# Create your models here.
class Teacher(models.Model):
    JOBTYPE = (('0', '讲师'), ('1', '导员'), ('2', '心理老师'), ('3', '文员'), ('4', '就业老师'))
    name = models.CharField(max_length=20)
    jobtype = models.CharField(max_length=1, choices=JOBTYPE)
    salary = models.DecimalField(max_digits=8, decimal_places=2)
    phone = models.CharField(max_length=11, null=True, blank=True)
    icon = models.CharField(max_length=255, blank=True, null=True, default='', )
    introduction = models.TextField(default='暂无介绍')


# tclass_set
# 班级类
class Tclass(models.Model):
    clsname = models.CharField(max_length=20)
    stucount = models.IntegerField()  # student 总数
    lecturer = models.ForeignKey(Teacher, on_delete=models.SET_DEFAULT, related_name='lecturer', default='0')  # 讲师
    instructor = models.ForeignKey(Teacher, on_delete=models.SET_DEFAULT, related_name='instructor', default='1')  # 导员
    classno = models.CharField(max_length=10)
    subject = models.CharField(max_length=20)  # 专业


class Gitinfo(models.Model):
    name = models.CharField(max_length=20)
    gitaddr = models.CharField(max_length=100)
    classblong = models.ForeignKey(Tclass, on_delete=models.SET_NULL, null=True)


class Student(models.Model):
    SEX = (('0', '女性'), ('1', '男性'))
    stu_name = models.CharField(max_length=20)
    sex = models.CharField(max_length=1, choices=SEX)
    cls = models.ForeignKey(Tclass, on_delete=models.SET_NULL, null=True)
    img_path = models.CharField(max_length=255)
    birthday = models.DateField(null=True)
    birthyear = models.IntegerField(null=True)
